/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
package com.ecommerce.controller.json;

import com.mycompany.pattern.Shop;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;

/**
 *
 * @author Yoonan
 */
@Controller
public class JSONController {

    @RequestMapping(value = "/json/{name}", //produces = "application/json",
            method = RequestMethod.GET)
    @ResponseBody
    public Shop getShopInJSON(@PathVariable String name) {

        Shop shop = new Shop();
        shop.setName(name);
        shop.setStaffName(new String[]{"เต้", "อยู่นาน"});

        return shop;

    }

}
